package tss.dsp;

import java.util.*;
import tss.*;

class ProcessSnapshot {
	private int processId;
	private Collection<Message> sentMessages, receivedMessages;
	private Object state;

	public ProcessSnapshot(int processId, Collection<Message> sentMessages,
			Collection<Message> receivedMessages, Object state) {
		if (processId < 0)
			throw new IllegalArgumentException(
					"Argument processId must be greater than zero.");
		if (sentMessages == null)
			sentMessages = new ArrayList<Message>();
		if (receivedMessages == null)
			receivedMessages = new ArrayList<Message>();

		this.processId = processId;
		this.sentMessages = Collections.unmodifiableCollection(sentMessages);
		this.receivedMessages = Collections
				.unmodifiableCollection(receivedMessages);
		this.state = state;
	}

	public int getProcessId() {
		return processId;
	}

	public Collection<Message> getReceivedMessages() {
		return receivedMessages;
	}

	public Collection<Message> getSentMessages() {
		return sentMessages;
	}

	public Object getState() {
		return state;
	}
}
